package com.siashan.toolkit.core.enums;

/**
 * Int 类型开关枚举类
 *
 * @author siashan
 * @date 2024-07-11
 */
public enum IntSwitch implements IBaseEnum<Integer> {
    /**
     * 否
     */
    NO(0, "否"),

    /**
     * 是
     */
    YES(1, "是");


    private Integer code;
    private String desp;

    IntSwitch(Integer code, String desp) {
        this.code = code;
        this.desp = desp;
    }


    @Override
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getDesp() {
        return desp;
    }

    public void setDesp(String desp) {
        this.desp = desp;
    }

    /**
     * 判断是否为YES
     *
     * @param codeVal code值
     * @return true/false
     */
    public static boolean isYes(Integer codeVal) {
        return YES.getCode().equals(codeVal);
    }

    /**
     * 判断是否为NO
     *
     * @param codeVal code值
     * @return true/false
     */
    public static boolean isNo(Integer codeVal) {
        return NO.getCode().equals(codeVal);
    }

}
